package enums;

import java.util.Scanner;

public class EnumTest {
    public static void main(String[] args) {
        try (var in = new Scanner(System.in)) {
            System.out.println("Enter a size: (SMALL, MEDIUM, LARGE, EXTRA_LARGE)");
            String input = in.next().toUpperCase();

            Size size = Enum.valueOf(Size.class, input);

            System.out.println("size=" + size);
            System.out.println("abreviation=" + size.getAbreviation());

            if (size == Size.EXTRA_LARGE) {
                System.out.println("Good job--you paid attention to the _.");
            }
        }
    }
}

enum Size {
    SMALL("S"), MEDIUM("M"), LARGE("L"), EXTRA_LARGE("XL");

    private final String abreviation;

    private Size(String abreviation) {
        this.abreviation = abreviation;
    }

    public String getAbreviation() {
        return abreviation;
    }
}
